package com.fenghongzhang.day007;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.ashokvarma.bottomnavigation.BottomNavigationBar;
import com.ashokvarma.bottomnavigation.BottomNavigationItem;
import com.ashokvarma.bottomnavigation.TextBadgeItem;

public class Main2Activity extends AppCompatActivity implements BottomNavigationBar.OnTabSelectedListener {


    private static final String TAG = "Main2Activity";
    private BottomNavigationBar bar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);


        bar = (BottomNavigationBar) findViewById(R.id.bar);

        bar.setTabSelectedListener(this)
            .setMode(BottomNavigationBar.MODE_FIXED)
            .setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC)
            .setBarBackgroundColor("#000000")
            .setActiveColor("#ff0000")
            .setInActiveColor("#ffffff");


        TextBadgeItem textBadgeItem = new TextBadgeItem();
        textBadgeItem.setText("22").setTextColor(Color.GREEN).setBackgroundColor("#ffffff");

        bar.addItem(new BottomNavigationItem(R.drawable.rcd_icn_love,"首页").setBadgeItem(textBadgeItem))
                .addItem(new BottomNavigationItem(R.mipmap.ic_launcher,"同城").setActiveColor("#00ff00"))
                .addItem(new BottomNavigationItem(R.mipmap.ic_launcher,"我的"))
                .addItem(new BottomNavigationItem(R.mipmap.ic_launcher,"消息"))
                .initialise();


    }

    @Override
    public void onTabSelected(int position) {
        Log.i(TAG, "onTabSelected: 选中");
    }

    @Override
    public void onTabUnselected(int position) {
        Log.i(TAG, "onTabUnselected: 为选中");
    }

    @Override
    public void onTabReselected(int position) {
        Log.i(TAG, "onTabReselected: 点两次了.");
    }


}
